import java.util.*;
import static java.lang.System.*;

public class Resheto {
	public static void main(String[] args) {
		long lim = 1<<16;

		if (args.length > 0)
			lim = Long.parseLong(args[0]);
		long[] r_low = reshetoLow(lim);
		out.println("low: " + Arrays.toString(r_low));
		long[] r_hi  = reshetoHigh(lim);
		out.println("hi: " + Arrays.toString(r_hi));
	}

	/*
	 * What's up with these?
	 */
	public static long[] reshetoLow(long lim) {
		long[] ret = new long[(int)lim + 1];
		long i, j;

		for (i = 0; i <= lim; i++) {
			if (ret[(int)i] == 0)
				for (j = i; j <= lim; j += i)
					if (ret[(int)j] == 0)
						ret[(int)j] = i;
		}
		return ret;
	}

	public static long[] reshetoHigh(long lim) {
		long[] ret = new long[(int)lim + 1];
		long i, j;

		for (i = 0; i <= lim; i++)
			for (j = i; j <= lim; j += i)
				ret[(int)j] = i;
		return ret;
	}
}
